/*
 * @Author: Starfish_DL
 * @Date: 2020-10-14 23:20:39
 * @LastEditors: Starfish_DL
 * @LastEditTime: 2020-10-15 21:21:12
 * @CurrentVersion: 1.0
 * @Description: 
 */

public class Test {
	public static void main(String[] args) throws CloneNotSupportedException{
		Dog dog1 = new Dog();
		Dog dog2 = dog1.clone();
		//note 此处dog2是dog1的一个副本，但是两者不指向堆内存中的同一对象，所以下面程序输出是false
		System.out.println(dog1.equals(dog2));
	}
}
     //note 类先实现Cloneable接口S
    class Dog implements Cloneable{
        public Dog() {
        //todo Auto-generated constructor stub
        }
        //done 自定义类实现自己的clone()方法
        public Dog clone() throws CloneNotSupportedException{
        //done 通过super.clone()实现clone()方法
        return (Dog) super.clone();
	}
}